package zisu.algorithm.algorithm.SegmentTree;

public class Main {
    //线段树 就可以查询 某个区间的最大值和最小值。
    public static void main(String[] args) {
        Integer[] num = {-2,0,3,-5,2,-1};
        SegmentTree<Integer> segmentTree = new SegmentTree<>(num, new Merge<Integer>() {
            @Override
            public Integer merge(Integer a, Integer b) {
                return a+b;
            }
        });
        System.out.println(segmentTree.query(0,2));
        System.out.println(segmentTree.query(2,5));
        System.out.println(segmentTree.query(0,5));
    }
}